package org.jianghu.activity.user.login.presenter;


import com.avos.avoscloud.AVException;
import com.avos.avoscloud.AVUser;
import com.avos.avoscloud.LogInCallback;

import org.jianghu.activity.user.login.view.LoginView;
import org.jianghu.base.BaseRequest;
import org.jianghu.base.model.MsMessage;
import org.jianghu.utils.JH;


/**
 * Created by Gtexpress on 16/12/7.
 */

public class LoginPresenterCompl implements LoginPresenter {


    private LoginView loginView;

    public LoginPresenterCompl(LoginView loginView){
        this.loginView = loginView;
    }


    @Override
    public void doLogin(String user, String pwd) {
        AVUser.logInInBackground(user, pwd, new LogInCallback<AVUser>() {
            @Override
            public void done(AVUser avUser, AVException e) {
                if (e == null){
                    loginView.onLoginResult(true,"登陆成功");
                }else{
                    loginView.onLoginResult(false,"通行证或暗号错误");
                }
            }
        });
    }
}
